﻿$(function(){
    $("#LoginForm").validate({
        onfocusin:function(element){
            $(element).valid();
        },
        rules:{
            txtUnm:{required:true,minlength:3},
            txtPwd:{required:true,minlength:3}
        },
        messages:{
            txtUnm:{required:"用户名不能为空",minlength:"至少输入3个字符"},
            txtPwd:{required:"用户密码不能为空",minlength:"至少输入3个字符"}
        },
        errorElement:"div",
        errorPlacement:function(error,element){
            error.appendTo(element.parent());
        },
        submitHandler:function(form){
            form.submit();
        },        
        errorClass:"error",
        success:function(div){          
            div.html("填写正确！").addClass("success");
        }
    });
});